package json;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

public class ObjectMapperTest {

    public static void main(String[] args) throws JsonProcessingException {
        Student student = new Student();
        student.setName("test");
        student.setGrade("1");
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        Person person = objectMapper.readValue(JSONObject.toJSONString(student), Student.class);
        System.out.println(person.getName());

    }

}
